Using NodesUsing Tile MapsOn this pageUsing Tile Maps In game development, tile maps are a common way to construct scenes. This article will introduce how to create tile maps using Tiled Editor, how to load and render these maps using the TileNode class in the Dora SSR game engine, and how to read layered data from the maps. 1. Introduction to Tiled Editor Tiled Editor is a free, open-source, and powerful tile map editor. It supports various map formats and layers, making it convenient to create complex game scenes. Key features include: Multi-platform support: Runs on Windows, macOS, Linux, and other operating systems. Flexible layer system: Supports multi-layer map editing, including tile layers, object layers, and image layers. Rich export formats: Supports exporting to JSON, XML, TMX, and other formats for easy integration with various game engines. 2. Loading and Rendering Tile Maps with TileNode 2.1 Preparation First, ensure that Tiled Editor is installed and you have created a tile map exported as a TMX (XML format) file. For example, we have a map file named platform.tmx. 2.2 Creating a TileNode Instance In your Lua script, first load the TileNode module, then create a TileNode object. LuaTealTypeScriptYueScriptlocal TileNode <const> = require("TileNode")-- Load the entire maplocal tmxNode = TileNode("TMX/platform.tmx")local TileNode <const> = require("TileNode")-- Load the entire map, including all layerslocal tmxNode = TileNode("TMX/platform.tmx")import { TileNode } from "Dora";// Load the entire map, including all layersconst tmxNode = TileNode("TMX/platform.tmx");_ENV = Dora-- Load the entire map, including all layerstmxNode = TileNode "TMX/platform.tmx" If you want to load only specific layers, you can specify the layer name when creating the TileNode: LuaTealTypeScriptYueScript-- Load a specific layerlocal tmxNode = TileNode("TMX/platform.tmx", "Far")-- Load a specific layerlocal tmxNode = TileNode("TMX/platform.tmx", "Far")// Load a specific layerconst tmxNode = TileNode("TMX/platform.tmx", "Far");-- Load a specific layertmxNode = TileNode "TMX/platform.tmx" "Far" Or load multiple specific layers: LuaTealTypeScriptYueScript-- Load multiple layerslocal tmxNode = TileNode("TMX/platform.tmx", {"Far", "Near"})-- Load multiple layerslocal tmxNode = TileNode("TMX/platform.tmx", {"Far", "Near"})// Load multiple layersconst tmxNode = TileNode("TMX/platform.tmx", ["Far", "Near"]);-- Load multiple layerstmxNode = TileNode "TMX/platform.tmx", ["Far", "Near"] 2.3 Adding TileNode to the Scene Tree